package com.example.service.impl;

import com.example.domain.Songlist;
import com.example.mapper.SonglistMapper;
import com.example.service.SonglistService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:根据歌单查询条件查询个单列表
 * @Author: Ma_XiaoLong
 * @CreateTime： 2024/1/15 11:02
 */
@Service
public class SonglistServiceImpl implements SonglistService {
    @Autowired
    private SonglistMapper songlistMapper;
    @Override
    public List<Songlist> getListBySonglist(Songlist songlist) {
        //开启分页，将页码、每页记录数
        PageHelper.startPage(songlist.getPageNum(),songlist.getPageSize());
        List<Songlist> songlists = songlistMapper.selectListBySonglist(songlist);
        return songlists;
    }

    @Override
    public Songlist getById(Integer id) {
        return songlistMapper.selectById(id);
    }

    @Override
    public int updateById(Songlist songlist) {
        return songlistMapper.updateById(songlist);
    }
/**
 * @Description: 新增歌单
 * @Author: Ma_XiaoLong
 * @CreateTime: 2024/1/17 10:47
 * @param: songlist
 * @return: int
 **/
    @Override
    public int saveSonglist(Songlist songlist) {
     //   songlist.setCreateUserId();//
        return songlistMapper.insertSonglist(songlist);
    }

    @Override
    public int deleteById(Integer id) {
        /*删除：物理删除、逻辑删除（一般）*/
        return songlistMapper.deleteById(id);
    }


}
